//
//  TodayActivityCollectionViewCell.swift
//  XMYouPin
//
//  Created by 王宗成 on 2019/7/6.
//  Copyright © 2019 王宗成. All rights reserved.
//

import UIKit

class TodayActivityCollectionViewCell: UICollectionViewCell {
    
    var model:ItemModel? = nil
    {
        didSet
        {
            guard let item = model else {
                
                return
            }
            
            self.imageView.kf.setImage(with: URL(string:item.pic_url ?? ""))
            self.titleLabel.text = item.title ?? ""
        }
    }
    
    
    public lazy var imageView : UIImageView = {
        let imageView = UIImageView()
        self.addSubview(imageView)
        return imageView
    }()
    
    public lazy var titleLabel : UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 12)
        label.textColor = UIColor.hexColor(hexadecimal: "#666666")
        label.textAlignment = NSTextAlignment.center
        self.addSubview(label)
        return label
    }()
  
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        self.imageView.snp.makeConstraints { (make) in
            make.top.equalTo(7)
            make.centerX.equalToSuperview()
            make.size.equalTo(CGSize(width: 50*kHeightRatio, height: 50*kHeightRatio))
        }
        self.titleLabel.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(self.imageView.snp.bottom).offset(2)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
